﻿@{int i = 0;}@inherits  BuildCodeViewPage<TableInfo>
using System;
using System.Text;
using System.Collections.Generic;
using TjZheng.Base;
namespace @(Model.Namespace).DataEntity
{
    /// <summary>
    /// @Model.Description
    /// </summary>
    [Serializable]
    public class @Model.Name : EntityBase
    {
        #region Private Properties
    @foreach (var columnInfo in Model.ColumnInfos)
    {
        <tj>private @CurrentBuilder.GetNoticeType(columnInfo.DataType,columnInfo.IsNull) _@columnInfo.Name.ToFirstLower() { get; set; }</tj>
    }
        #endregion

        #region Public Properties
@foreach (var columnInfo in Model.ColumnInfos)
{
        <tj>/// <summary>
        /// @columnInfo.Description
        /// </summary>
    @if(i==0)
    {
        <tj>[PrimaryKey]</tj>
    }
@if(CurrentBuilder.IsString(columnInfo.DataType))
{
        <tj>[Validator(IsRequired = @((!columnInfo.IsNull).ToString().ToLower()), MaxLength = @(columnInfo.Datalength), DefaultValue = @Raw(columnInfo.DefaultValue.IsNoNull()?"\""+columnInfo.DefaultValue+"\"":"\"\""))]</tj>
}
        public @CurrentBuilder.GetNoticeType(columnInfo.DataType,columnInfo.IsNull) @columnInfo.Name.ToFirstUpper()
        {
            get
            {
                return this._@columnInfo.Name.ToFirstLower();
            }
            set
            {
                this._@columnInfo.Name.ToFirstLower() = value;
            }
        }</tj>
        i++;
}
        #endregion

        #region Construction
        /// <summary>
        /// 构造函数
        /// </summary>
        public @(Model.Name)()
        {
    @{
        foreach (var columnInfo in Model.ColumnInfos.Skip(1))
        {
            if (columnInfo.IsNull)
            {
                <tj>this._@(columnInfo.Name.ToFirstLower()) = null;</tj>
            }
            else
            {
                <tj>this._@(columnInfo.Name.ToFirstLower()) = @CurrentBuilder.SetDefaultValue(CurrentBuilder.GetNoticeType(columnInfo.DataType));</tj>
            }
        }
    }
        }
        #endregion
    }
}